<template>
  <div>
    <div class="top_item">
      <div class="zuo" ref="continer"></div>
      <div class="you">
        <div><span>男生</span><span>女生</span></div>
        <div class="you_item">
          <div v-for="(item, index) in data" :key="index">
            <div>{{ item.num }}</div>
            <div>{{ item.floor }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import * as echarts from 'echarts'
import { onMounted, ref, shallowRef } from 'vue'
import { getmenjin } from '../../request'

const data=ref([])
let option  =ref({})
const continer=shallowRef()
onMounted(()=>{
    getmenjin().then((res)=>{
        data.value=res.data.data.result[0].tableData
         var myChart = echarts.init(continer.value)
           option.value = res.data.data.result[0].option
           myChart.setOption(option.value)
           const onresize=()=>{
            myChart.resize()
           }
           onresize()
           window.addEventListener('resize',onresize)
    })
})
</script>
<style>
.top_item {
  font-size: 16px;
  margin-top: 10px;
  width: 100%;
  height: 160px;
  background: #0c1d5f;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.zuo {
  width: 45% !important;
  height: 130px;
}
.you {
  color: #fff;
}
.you > div:nth-child(1) {
  height: 60px;
  line-height: 60px;
  text-align: center;
}
.you span {
  margin: 0px 20px;
}

.you_item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  text-align: center;
  font-size: 14px;
  color: #ccc;
  margin: 0px 10px;
}
.you_item div {
  margin: 0px 5px;
}
</style>


